//package com.coldchain.order.service.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.coldchain.common.feign.CompanyFeign;
//import com.coldchain.cys.entity.Car;
//import com.coldchain.cys.entity.CarDriver;
//import com.coldchain.common.feign.CarDriverFeign;
//import com.coldchain.common.feign.CarFeign;
//import com.coldchain.message.MessageUtils;
//import com.coldchain.message.core.entity.order.DispatchMsg;
//import com.coldchain.message.core.entity.order.HelpMsg;
//import com.coldchain.message.core.entity.order.NewsMsg;
//import com.coldchain.order.entiy.*;
//import com.coldchain.order.mapper.*;
//import com.coldchain.order.service.IBizDispatchingOrderServicecoo;
//import com.coldchain.order.service.IBizReceiverPersonService;
//import com.coldchain.order.service.IOrderService;
//import com.coldchain.common.vo.AdminOrderData;
//import BusinessException;
//import BaseResponse;
//import ObjectRestResponse;
//import DateUtil;
//import FunctionUtils;
//import ValidateUtil;
//import com.fangliai.core.base.service.impl.BaseServiceImpl;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.math.BigDecimal;
//import java.util.Arrays;
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * <p>
// * 配送订单 服务实现类
// * </p>
// *
// * @author fangliai
// * @since 2018-09-11
// */
//@Service
//@SuppressWarnings({ "unchecked", "rawtypes" })
//public class BizDispatchingOrderServiceImpl extends BaseServiceImpl<BizDispatchingOrderMappercao,BizDispatchingOrdercao> implements IBizDispatchingOrderServicecoo {
//	@Autowired
//	private BizReceiverPersonMapper bizReceiverPersonMapper;
//	@Autowired
//	private BizReceiverGoodsMapper bizReceiverGoodsMapper;
//	@Autowired
//	private BizDispatchingOrderMappercao bizDispatchingOrderMapper;
//	@Autowired
//	private IOrderService orderService;
//	@Autowired
//	private OrderMapper orderMapper;
//	@Autowired
//	private IBizReceiverPersonService bizReceiverPersonService ;
//	@Autowired
//	private CarFeign carFeign ;
//	@Autowired
//	private CarDriverFeign carDriverFeign;
//	@Autowired
//	private MessageUtils messageUtils;
//	@Autowired
//	private CreditOrderMapper creditOrderMapper;
//	@Autowired
//	private CompanyFeign companyFeign;
//	@Override
//	public ObjectRestResponse findByCarId(Long catId, Integer static,Long startimer,Long endtimer,String orderid) {
//		Map<String,Object> map = new ConcurrentHashMap<>();
//		if(catId==null){
//			throw new BusinessException("车辆Id");
//		}
//		QueryWrapper<BizDispatchingOrdercao> ew = new QueryWrapper<BizDispatchingOrdercao>();
//		ew.eq("car_id",catId);
//		if(!ValidateUtil.Objectempty(static)){
//			ew.eq("static",static);
//		}
//		if(!ValidateUtil.Objectempty(startimer)){
//			ew.gt("createtime", new Date(startimer));
//		}
//		if(!ValidateUtil.Objectempty(endtimer)){
//			ew.lt("createtime",new Date(endtimer));
//		}
//		if(ValidateUtil.stringEmpty(orderid)){
//			ew.eq("order_id",orderid);
//		}
//		ew.orderByDesc("createtime");
//		Integer neworder=this.bizDispatchingOrderMapper.countStatus(catId, 2);
//		Integer deliveredorder=this.bizDispatchingOrderMapper.countStatus(catId, 3);
//		Integer responseorder=this.bizDispatchingOrderMapper.countStatus(catId, 4);
//
//		List<BizDispatchingOrdercao> list = super.list(ew);
//		if(!list.isEmpty()){
//			for(BizDispatchingOrdercao b:list){
//				if(b!=null){
//					QueryWrapper<BizReceiverPerson> wrapper = new QueryWrapper<BizReceiverPerson>();
//					wrapper.eq("biz_id",b.getBizId());
//					wrapper.orderByAsc("sort");
//					b.setReceiver(bizReceiverPersonMapper.selectList(wrapper));
//				}
//			}
//		}
//		map.put("chingOrder", list);
//		map.put("neworder",neworder );
//		map.put("deliveredorder",deliveredorder );
//		map.put("responseorder",responseorder );
//		return FunctionUtils.getSuccessRest("",map);
//	}
//	@Override
//	public ObjectRestResponse sendOrder(String bizId, Integer static) {
//		if(bizId==null||"".equals(bizId)){
//			throw new BusinessException("未找到订单记录");
//		}else if(static==null){
//			throw new BusinessException("未找到状态");
//		}
//		BizDispatchingOrdercao entity = new BizDispatchingOrdercao();
//		QueryWrapper<BizDispatchingOrdercao> ew = new QueryWrapper<BizDispatchingOrdercao>();
//		ew.eq("biz_id", bizId);
//		ew.eq("static", static);
//		boolean falg = super.update(entity, ew);
//		if(falg){
//			return FunctionUtils.getSuccessRest(static+"");
//		}
//		//XXX 推送消息
//		throw new BusinessException(static+"");
//
//	}
//
//	@Override
//	public ObjectRestResponse<Object> showBizOrderDetail(String bizId) {
//		BizDispatchingOrdercao bizOrder = super.getById(bizId);
//		int success =0;
//		if(bizOrder!=null){
//			QueryWrapper<BizReceiverPerson> eceiver = new QueryWrapper<BizReceiverPerson>();
//			eceiver.eq("biz_id",bizOrder.getBizId());
//			List<BizReceiverPerson> list = this.bizReceiverPersonMapper.selectList(eceiver);
//			for(BizReceiverPerson b:list){
//				if(b!=null){
//					if(ValidateUtil.isEquals(b.getStatus(), 4)){
//						success++;
//					}
//					StringBuffer goodsdetail = new StringBuffer();
//					QueryWrapper<BizReceiverGoods> ew = new QueryWrapper<BizReceiverGoods>();
//					ew.eq("biz_id", b.getBizId());
//					List<BizReceiverGoods> goods = this.bizReceiverGoodsMapper.selectList(ew);
//					for(BizReceiverGoods g:goods){
//						goodsdetail.append(g.getGoodsName()+" "+g.getQty()+g.getUnitname()).append(",");
//					}
//					if(goodsdetail.length()>1){
//						goodsdetail.delete(goodsdetail.length()-1, goodsdetail.length());
//					}
//					b.setGoodsdetail(goodsdetail.toString());
//				}
//			}
//			bizOrder.setSuccessCount(success);
//			bizOrder.setWorkcount(list==null?0:list.size());
//			bizOrder.setReceiver(list);
//		}
//		return new ObjectRestResponse<Object>(bizOrder);
//	}
//
//	private String getPayName(Integer pay){
//		if(pay==null){
//			return "";
//		}else if(pay==1){
//			return "微信";
//		}else if(pay==2){
//			return "支付宝";
//		}else if(pay==3){
//			return "银行卡";
//		}else if(pay==3){
//			return "信用支付";
//		}
//		return "";
//	}
//
//	@Override
//	public IPage<BizDispatchingOrdercao> userLogOrder(Page page,BizDispatchingOrdercao vo) {
//		IPage<BizDispatchingOrdercao> rcords = this.bizDispatchingOrderMapper.findUserBack(page,vo);
//		List<BizDispatchingOrdercao> bizorders = rcords.getRecords();
//		for(BizDispatchingOrdercao bizorder: bizorders){//配送订单
//			QueryWrapper<BizReceiverPerson> receiverew = new QueryWrapper<BizReceiverPerson>();
//			receiverew.eq("biz_id",bizorder.getBizId());
//			receiverew.orderByAsc("sort");
//			bizorder.setPayName(getPayName(this.orderMapper.getPay(bizorder.getOrderId())));
//			if(bizorder.getCarId()!=null){
//				ObjectRestResponse<Car> carInfo = this.carFeign.getCarInfo(bizorder.getCarId());
//				if(carInfo.getStatus()==200){
//					Car car = carInfo.getData();
//					if(car!=null){
//						bizorder.setCarNumber(car.getPlateNumber());
//						ObjectRestResponse<CarDriver> carDriverInfo = this.carDriverFeign.getCarDriverInfo(car.getDriverid());
//						if(carInfo.getStatus()==200){
//							CarDriver carDrover = carDriverInfo.getData();
//							if(carDrover!=null){
//								bizorder.setDriverName(carDrover.getName());
//							}
//						}
//					}
//				}
//			}
//			bizorder.setReceiver(bizReceiverPersonMapper.selectList(receiverew));
//			for(BizReceiverPerson b :bizorder.getReceiver()){
//				QueryWrapper<BizReceiverGoods> ew = new QueryWrapper<BizReceiverGoods>();
//				ew.eq("receiverid", b.getId());
//				List<BizReceiverGoods> goods = this.bizReceiverGoodsMapper.selectList(ew);
//				b.setGoods(goods);
//			}
//		}
//		return rcords;
//	}
//
//	@Override
//	public IPage<BizDispatchingOrdercao> cysOrder(Page page, BizDispatchingOrdercao vo) {
//		return this.bizDispatchingOrderMapper.findCys(page,vo);
//	}
//
//	@Override
//	public IPage<BizDispatchingOrdercao> sysBizOrder(Page page){
//		QueryWrapper<BizDispatchingOrdercao> query = new QueryWrapper<BizDispatchingOrdercao>();
//		query.isNull("car_id");
//		return super.page(page, query);
//	}
//
//	@Override
//	public IPage<BizDispatchingOrdercao> sysTurnOrder(Page page) {
//		QueryWrapper<BizDispatchingOrdercao> query = new QueryWrapper<BizDispatchingOrdercao>();
//		query.isNotNull("turnid");
//		return super.page(page, query);
//	}
//
//	@Transactional
//	@Override
//	public ObjectRestResponse bindCar(String  drvierId,String orderId,BigDecimal price){
//		QueryWrapper<BizDispatchingOrdercao> wrapper = new QueryWrapper<BizDispatchingOrdercao>();
//		wrapper.eq("order_id", orderId);
//		BizDispatchingOrdercao bizorder = super.getOne(wrapper);
//		if(bizorder==null||bizorder.getCarId()!=null){
//			throw new BusinessException("未找到订单或已有车辆");
//		}else if(price.compareTo(bizorder.getTotlaPrice())>0){
//			throw new BusinessException("不能高于原价");
//		}
//		ObjectRestResponse<Car> carResult = carFeign.getCarInfo(carid);
//		if(carResult.getStatus() != 200){
//			throw new BusinessException(carResult.getMessage()) ;
//		}
//		Car car = carResult.getData();
//		if(car==null||!ValidateUtil.isEquals(car.getStatus(), 0)){
//			throw new BusinessException("未找到车辆或车俩不在闲置");
//		}
//		BigDecimal temperature01 = car.getTemperature01();
//		if(temperature01.intValue()>bizorder.getCarOcMax()||temperature01.intValue()<bizorder.getCarOcMin()){
//			throw new BusinessException("指派失败 车辆不支持最高"+bizorder.getCarOcMax()+"最低"+bizorder.getCarOcMin());
//		}
//		Order order = this.orderMapper.selectById(bizorder.getOrderId());
//		bizorder.setCarId(car.getId());
//		bizorder.setAmount(price);
//		bizorder.setStatus(2);
//		order.setCysId(car.getCid());
//		order.setPrice(price);
//		if(!super.updateById(bizorder)||this.orderMapper.updateById(order)<1){
//			throw new BusinessException("对不起网络无法连接");
//
//		}
//		BaseResponse response = carFeign.doChangeCarWorkstatus(carid,1);
//		if(response.getStatus()!=200){
//			throw new BusinessException(response.getMessage());
//		}
//		//XXX 消息推送
//		DispatchMsg dispatchMsg = new DispatchMsg(order.getOrderId(), bizorder.getLongitude()+"", bizorder.getLatitude()+"",car.getDriverid()+"");
//		this.messageUtils.sendOrderMsg(dispatchMsg);
//		return FunctionUtils.getSuccessRest("指派成功，已通知司机");
//	}
//
//	@Transactional
//	@Override
//	public ObjectRestResponse turnOrder(String biz) {
//		BizDispatchingOrdercao bizorder = super.getById(biz);
//		if(bizorder==null||bizorder.getCarId()==null){
//			throw new BusinessException("未找到订单或还没有车辆不需要转单");
//		}
//		bizorder.setTurnid(bizorder.getCarId());
//		bizorder.setCarId(null);
//		bizorder.setOrderType(3);
//		if(!super.updateById(bizorder)){
//			throw new BusinessException("系统繁忙,转单失败");
//
//		}
//		ObjectRestResponse<Car> response = carFeign.getCarInfo(bizorder.getCarId());
//		if(response.getStatus()!=200){
//			throw new BusinessException(response.getMessage());
//		}
//		Car car = response.getData();
//		BaseResponse baseResponse = this.carFeign.doChangeCarWorkstatus(car.getId(),0);
//		if(baseResponse.getStatus()!=200){
//			throw new BusinessException(baseResponse.getMessage());
//		}
//		baseResponse = this.carDriverFeign.doIncrementRetreatOrder(car.getDriverid());
//		if(baseResponse.getStatus()!=200){
//			throw new BusinessException(baseResponse.getMessage());
//		}
//		//XXX 消息推送
//		HelpMsg help = new HelpMsg(bizorder.getOrderId(),bizorder.getLongitude()+"",bizorder.getLatitude()+"", car.getId()+"", car.getCarTypeName(), "");
//		this.messageUtils.sendOrderMsg(help);
//		return FunctionUtils.getSuccessRest("你已转单成功");
//	}
//
//	@Override
//	public ObjectRestResponse checkGoodsCar(String startLogUrl, String bizId) {
//		BizDispatchingOrdercao bizorder = super.getById(bizId);
//		if(ValidateUtil.Objectempty(bizorder)){
//			throw new BusinessException("未找到订单记录");
//
//		}else if(bizorder.getStatus()>2){
//			throw new BusinessException("订单已验货上过车");
//		}
//		bizorder.setStartLogUrl(startLogUrl);
//		bizorder.setStatus(3);
//		if(!super.updateById(bizorder)){
//			throw new BusinessException("验货上车失败,请重试");
//		}
//		QueryWrapper<BizReceiverPerson> queryWrapper = new QueryWrapper<BizReceiverPerson>();
//		queryWrapper.eq("biz_id", bizId);
//		BizReceiverPerson person = new BizReceiverPerson();
//		person.setStatus(1);
//		Integer updateCount = this.bizReceiverPersonMapper.update(person, queryWrapper);
//		if(updateCount!=null&&updateCount >0){
//			return FunctionUtils.getSuccessRest("已确定验货上车");
//		}
//		throw new BusinessException("验货上车失败,请重试");
//
//	}
//	@Override
//	public ObjectRestResponse<BizDispatchingOrdercao> getByOrderId(String orderId) {
//		QueryWrapper<BizDispatchingOrdercao> ew = new QueryWrapper<BizDispatchingOrdercao>();
//		ew.eq("order_id", orderId) ;
//		BizDispatchingOrdercao biz = super.getOne(ew);
//
//		QueryWrapper<BizReceiverPerson> countWrapper = new QueryWrapper<BizReceiverPerson>() ;
//		countWrapper.eq("biz_id", biz.getBizId()) ;
//		int workcount = bizReceiverPersonService.count(countWrapper);
//		countWrapper.eq("static", 4);
//		int successCount = bizReceiverPersonService.count(countWrapper);
//		biz.setWorkcount(workcount);
//		biz.setSuccessCount(successCount);
//		return new ObjectRestResponse<BizDispatchingOrdercao>(biz) ;
//	}
//	@Transactional
//	@Override
//	public ObjectRestResponse<String> sendStartError(String bizId, String errorLogUrl, String errorMsg,
//			Integer errorCode) {
//		BizDispatchingOrdercao bizorder = super.getById(bizId);
//		if(ValidateUtil.Objectempty(bizorder)||!ValidateUtil.isEquals(bizorder.getStatus(),2)){
//			throw new BusinessException("未找到订单记录或已取货");
//		}
//		bizorder.setStatus(-1);
//		bizorder.setErrorCode(errorCode);
//		bizorder.setErrorLogUrl(errorLogUrl);
//		if(!super.updateById(bizorder)){
//			throw new BusinessException("网络连接错误，请重试");
//		}
//		Order order = new Order();
//		order.setStatus(2);
//		QueryWrapper<Order> wrapper = new QueryWrapper<Order>();
//		wrapper.eq("order_id",bizorder.getOrderId());
//		int ordercount = this.orderMapper.update(order,wrapper);
//		if(ordercount<1){
//			throw new BusinessException("网络连接错误，请重试");
//		}
//
//		QueryWrapper<BizReceiverPerson> ew = new QueryWrapper<BizReceiverPerson>();
//		ew.eq("biz_id",bizId);
//
//		BizReceiverPerson person = new BizReceiverPerson();
//		person.setStatus(-1);
//		int personCount = this.bizReceiverPersonMapper.update(person, ew);
//		if(personCount<1){
//			throw new BusinessException("网络连接错误，请重试");
//		}
//		BaseResponse car = this.carFeign.doChangeCarWorkstatus(bizorder.getCarId(),0);
//		if(car.getStatus()!=200){
//			throw new BusinessException(car.getMessage());
//		}
//		return FunctionUtils.getSuccessRest("异常已提交");
//	}
//	@Override
//	public ObjectRestResponse<List<MyOrder>> simpleOrderList(MyOrder myOrder) {
//		QueryWrapper<BizDispatchingOrdercao> wrapper = new QueryWrapper<BizDispatchingOrdercao>();
//		if(!ValidateUtil.Objectempty(myOrder)){
//			if(ValidateUtil.stringEmpty(myOrder.getBizId())){
//				wrapper.eq("biz.biz_id", myOrder.getBizId());
//			}
//			if(ValidateUtil.stringEmpty(myOrder.getOrderId())){
//				wrapper.eq("biz.order_id", myOrder.getOrderId());
//			}
//			if(!ValidateUtil.Objectempty(myOrder.getStatus())){
//				wrapper.eq("biz.static", myOrder.getStatus());
//			}
//			if(ValidateUtil.stringEmpty(myOrder.getCompanyId())){
//				wrapper.eq("c.company_id", myOrder.getCompanyId());
//			}
//			if(!ValidateUtil.Objectempty(myOrder.getCysId())){
//				wrapper.eq("c.cys_id",myOrder.getCysId());
//			}
//			if(ValidateUtil.stringEmpty(myOrder.getStatusAll())){
//				String[] statusAll = myOrder.getStatusAll().split(",");
//				if(statusAll.length>0){
//					wrapper.in("biz.static", Arrays.asList(statusAll));
//				}
//			}
//			if(!ValidateUtil.Objectempty(myOrder.getStarttime())){
//				wrapper.gt("biz.createtime", myOrder.getStarttime());
//			}
//			if(!ValidateUtil.Objectempty(myOrder.getEndtime())){
//				wrapper.lt("biz.createtime",myOrder.getEndtime());
//			}
//			if(!ValidateUtil.Objectempty(myOrder.getDatetype())){
//				Date[] dates = getDateType(myOrder.getDatetype());
//				wrapper.between("biz.createtime", dates[0], dates[1]);
//			}
//		}
//		List<MyOrder> list = this.bizDispatchingOrderMapper.simpleOrderList(wrapper);
//		return FunctionUtils.getSuccessRest("查询成功", list);
//	}
//
//
//	@Transactional
//	@Override
//	public ObjectRestResponse<String> pay(String bizid, Integer paytype) {
//		BizDispatchingOrdercao bizOrder = super.getById(bizid);
//		if(bizOrder==null||!ValidateUtil.isEquals(bizOrder.getStatus(),0)){
//			return FunctionUtils.getFailRest("未找到订单记录或已支付");
//		}else if(ValidateUtil.Objectempty(paytype)){
//			return FunctionUtils.getFailRest("未找到支付方式");
//		}else if(!ValidateUtil.isEquals(paytype, 1)
//				&&!ValidateUtil.isEquals(paytype, 2)
//				&&!ValidateUtil.isEquals(paytype, 3)
//				&&!ValidateUtil.isEquals(paytype, 4)){
//			return FunctionUtils.getFailRest("未找到支付方式");
//		}
//
//		Order order = this.orderMapper.selectById(bizOrder.getOrderId());
//		order.setChannel(paytype);
//		if(order==null||!ValidateUtil.isEquals(order.getStatus(),0)){
//			return FunctionUtils.getFailRest("未找到订单记录或已支付");
//		}
//		ObjectRestResponse<String> response = payHandle(order);
//		if(!ValidateUtil.isEquals(response.getStatus(),200)){
//			return FunctionUtils.getFailRest(response.getMessage());
//		}
//		bizOrder.setStatus(1);
//		boolean sign = super.updateById(bizOrder);
//		if(!sign){
//			throw new BusinessException("内部错误，请联系管理员");
//		}
//		order.setStatus(1);
//		int count = this.orderMapper.updateById(order);
//		if(count<1){
//			throw new BusinessException("内部错误，请联系管理员");
//		}
//		if(ValidateUtil.isEquals(4, paytype)){
//			//结算订单
//			CreditOrder creditOrder = this.creditOrderMapper.getUserId(order.getCompanyId(),DateUtil.getStartTimeOfMonth(new Date()));
//			if(creditOrder!=null){
//				creditOrder.setOrderCount(creditOrder.getOrderCount()+1);
//				creditOrder.setPrice(FunctionUtils.add(creditOrder.getPrice(),order.getPaymoney(),2));
//				this.creditOrderMapper.updateById(creditOrder);
//			}else{
//				creditOrder = new CreditOrder();
//				creditOrder.setUserId(order.getCompanyId());
//				creditOrder.setPrice(order.getPaymoney());
//				creditOrder.setOrderCount(1);
//				this.creditOrderMapper.insert(creditOrder);
//			}
//		}
//		//XXX 进行推送消息
//		NewsMsg msg = new NewsMsg(
//				bizOrder.getOrderId(),
//				bizOrder.getLongitude()+"",
//				bizOrder.getLatitude()+"",
//				bizOrder.getOrderType().intValue(),
//				bizOrder.getTotlaPrice(),
//				bizOrder.getShipAddress(),
//				bizOrder.getCarOcMax().intValue(),
//				bizOrder.getCarOcMin().intValue(),
//				bizOrder.getOrderKm().intValue(),
//				bizOrder.getInitiatePrice().doubleValue()
//				);
//		try{
//			messageUtils.sendOrderMsg(msg);
//		}catch (Exception e){
//
//		}
//		return FunctionUtils.getSuccessRest("支付成功");
//	}
//
//
//	private  ObjectRestResponse<String> payHandle(Order order){
//		switch (order.getChannel()) {
//			case 1:{
//				return FunctionUtils.getSuccessRest("支付成功");
//			}
//			case 2:{
//
//				return FunctionUtils.getSuccessRest("支付成功");
//				}
//			case 3:{
//
//				return FunctionUtils.getSuccessRest("支付成功");
//			}
//			case 4:{
//				ObjectRestResponse<String> useAmountPayOrder = this.companyFeign.useAmountPayOrder(order.getCompanyId(),order.getOrderId(),order.getPaymoney());
//				return useAmountPayOrder;
//			}
//			default:{
//				return FunctionUtils.getSuccessRest("支付成功");
//			}
//		}
//	}
//
//	private Date[] getDateType(Integer type){
//		Date tempdt = new Date();
//		Date[] dates = new Date[2];
//		if(ValidateUtil.isEquals(type, 1)){//今日
//			dates[0] = DateUtil.getStartTime(tempdt);
//			dates[1]  = DateUtil.getEndTime(tempdt);
//		}else if(ValidateUtil.isEquals(type, 2)){//近"+7+"天
//			dates[1]  = tempdt;
//			dates[0] = DateUtil.addDate(tempdt, -7);
//		}
//		else if(ValidateUtil.isEquals(type, 2)){//当月
//			dates[0] = DateUtil.getStartTimeOfMonth(tempdt);
//			dates[1] = DateUtil.getEndTimeOfMonth(tempdt);
//		}else if(ValidateUtil.isEquals(type, 3)){//年
//			dates[0] = DateUtil.getStartTimeOfYear(tempdt);
//			dates[1] = DateUtil.getEndTimeOfMonth(tempdt);
//		}
//		return dates;
//	}
//	@Override
//	public ObjectRestResponse<AdminOrderData> orderData(String starttime,String endtime,Integer datatype){
//		QueryWrapper<BizDispatchingOrdercao> wrapper = new QueryWrapper<>();
//		if(!ValidateUtil.Objectempty(datatype)){
//			Date[] datas = DateUtil.getDateType(datatype);
//			if(datas!=null&&datas.length>0){
//				wrapper.between("createtime", datas[0], datas[1]);
//			}
//		}
//		if(ValidateUtil.date(starttime)){
//			wrapper.gt("createtime", starttime);
//		}
//		if(ValidateUtil.date(endtime)){
//			wrapper.lt("createtime", endtime);
//		}
//		AdminOrderData orderData = this.bizDispatchingOrderMapper.payMoneyAndmoney(wrapper);
//		if(ValidateUtil.Objectempty(orderData)){
//			orderData = new AdminOrderData();
//			orderData.setPayMoney(BigDecimal.ZERO);
//			orderData.setPrice(BigDecimal.ZERO);
//		}
//		orderData.setSize(this.bizDispatchingOrderMapper.countOrder(wrapper));
//		QueryWrapper<BizDispatchingOrdercao> wrapperbackup = wrapper;
//		wrapperbackup.eq("static",-1);
//		orderData.setFailCount(this.bizDispatchingOrderMapper.countOrder(wrapperbackup));
//
//		wrapperbackup = wrapper;
//		wrapperbackup.eq("static",4);
//		orderData.setSuccess(this.bizDispatchingOrderMapper.countOrder(wrapperbackup));
//
//		wrapperbackup = wrapper;
//		wrapperbackup.ne("static", 0);
//		orderData.setPaysuccess(this.bizDispatchingOrderMapper.countOrder(wrapperbackup));
//
//		wrapper.eq("static",-1);
//		AdminOrderData orderDatabackup = this.bizDispatchingOrderMapper.payMoneyAndmoney(wrapper);
//		if(ValidateUtil.Objectempty(orderData)){
//			orderData.setFailMoney(orderDatabackup.getPayMoney()==null?BigDecimal.ZERO:orderDatabackup.getPayMoney());
//			orderData.setSuccessMoney(FunctionUtils.sub(orderData.getPayMoney(),orderData.getFailMoney(), 2));
//		}
//
//		return FunctionUtils.getSuccessRest("",orderData);
//	}
//
//
//}
